const {
  DataTypes
} = require('sequelize');
module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: "自增id",
      field: "id"
    },
    name: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "名称",
      field: "name"
    },
    alias: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "别名",
      field: "alias"
    },
    level: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "权重（数字越大权重越高）",
      field: "level"
    },
    is_enable: {
      type: DataTypes.INTEGER(3).UNSIGNED,
      allowNull: false,
      defaultValue: "1",
      primaryKey: false,
      autoIncrement: false,
      comment: "是否启用（0否，1是）",
      field: "is_enable"
    },
    contacts_name: {
      type: DataTypes.CHAR(60),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "联系人姓名",
      field: "contacts_name"
    },
    contacts_tel: {
      type: DataTypes.CHAR(15),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "联系电话",
      field: "contacts_tel"
    },
    province: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "所在省",
      field: "province"
    },
    city: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "所在市",
      field: "city"
    },
    county: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "所在县/区",
      field: "county"
    },
    address: {
      type: DataTypes.CHAR(80),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "详细地址",
      field: "address"
    },
    lng: {
      type: DataTypes.DECIMAL,
      allowNull: false,
      defaultValue: "0.0000000000",
      primaryKey: false,
      autoIncrement: false,
      comment: "经度",
      field: "lng"
    },
    lat: {
      type: DataTypes.DECIMAL,
      allowNull: false,
      defaultValue: "0.0000000000",
      primaryKey: false,
      autoIncrement: false,
      comment: "纬度",
      field: "lat"
    },
    is_default: {
      type: DataTypes.INTEGER(3).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "是否默认（0否, 1是）",
      field: "is_default"
    },
    is_delete_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "是否删除（0否，大于0删除时间戳）",
      field: "is_delete_time"
    },
    add_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "添加时间",
      field: "add_time"
    },
    upd_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "更新时间",
      field: "upd_time"
    }
  };
  const options = {
    tableName: "sxo_warehouse",
    comment: "",
    indexes: [{
      name: "name",
      unique: false,
      type: "BTREE",
      fields: ["name"]
    }, {
      name: "level",
      unique: false,
      type: "BTREE",
      fields: ["level"]
    }, {
      name: "is_enable",
      unique: false,
      type: "BTREE",
      fields: ["is_enable"]
    }, {
      name: "is_default",
      unique: false,
      type: "BTREE",
      fields: ["is_default"]
    }, {
      name: "is_delete_time",
      unique: false,
      type: "BTREE",
      fields: ["is_delete_time"]
    }]
  };
  const SxoWarehouseModel = sequelize.define("sxo_warehouse_model", attributes, options);
  return SxoWarehouseModel;
};